package com.itfreer.data.dictionary.base;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 定义字典标准字典项实体类
 */
public class DictionaryItem implements Serializable {

	private static final long serialVersionUID = 6625281869957696137L;

	/**
	 * id值，主键，唯一值
	 * 系统应用中必需关联此值
	 */
	private String id;
	
	/**
	 * 代码值
	 */
	private String code;
	
	/**
	 * 显示名称
	 */
	private String display;
	
	/**
	 * 拼音简称
	 */
	private String abbreviation;
	
	/**
	 * 单位
	 */
	private String units;
	
	/**
	 * 排序值
	 */
	private Integer order;
	
	/**
	 * 是否有效
	 */
	private Boolean valid = true;
	
	/**
	 * 备注
	 */
	private String info;
	
	/**
	 * 上级ID值
	 */
	private String pid;

	/**
	 * 级别
	 */
	private Integer level;

	/**
	 * 是否为最后级别
	 */
	private Boolean leaf;
	
	/**
	 * 当前级别的其它属性
	 */
	private Map<String, Object> other = new HashMap<String, Object>();
	
	/**
	 * 子字典对象
	 */
	private List<DictionaryItem> children = new ArrayList<DictionaryItem>();
	
	/**
	 * id值，主键，唯一值
	 * 系统应用中必需关联此值
	 */
	public String getId() {
		return id;
	}
	
	/**
	 * id值，主键，唯一值
	 * 系统应用中必需关联此值
	 */
	public void setId(String id) {
		this.id = id;
	}
	
	/**
	 * 代码值
	 */
	public String getCode() {
		return code;
	}
	
	/**
	 * 代码值
	 */
	public void setCode(String code) {
		this.code = code;
	}
	
	/**
	 * 显示名称
	 */
	public String getDisplay() {
		return display;
	}
	
	/**
	 * 显示名称
	 */
	public void setDisplay(String display) {
		this.display = display;
	}
	
	/**
	 * 拼音简称
	 */
	public String getAbbreviation() {
		return abbreviation;
	}
	
	/**
	 * 拼音简称
	 */
	public void setAbbreviation(String abbreviation) {
		this.abbreviation = abbreviation;
	}
	
	public String getUnits() {
		return units;
	}

	public void setUnits(String units) {
		this.units = units;
	}
	
	/**
	 * 排序值
	 */
	public Integer getOrder() {
		return order;
	}
	
	/**
	 * 排序值
	 */
	public void setOrder(Integer order) {
		this.order = order;
	}
	
	/**
	 * 是否有效
	 */
	public Boolean getValid() {
		return valid;
	}
	
	/**
	 * 是否有效
	 */
	public void setValid(Boolean isValid) {
		this.valid = isValid;
	}
	
	/**
	 * 备注
	 */
	public String getInfo() {
		return info;
	}
	
	/**
	 * 备注
	 */
	public void setInfo(String info) {
		this.info = info;
	}
	
	/**
	 * 上级ID值
	 */
	public String getPid() {
		return pid;
	}

	/**
	 * 上级ID值
	 */
	public void setPid(String pid) {
		this.pid = pid;
	}

	/**
	 * 级别
	 */
	public Integer getLevel() {
		return level;
	}

	/**
	 * 级别
	 */
	public void setLevel(Integer level) {
		this.level = level;
	}

	/**
	 * 是否为最后节点
	 * @return
	 */
	public Boolean getLeaf() {
		return leaf;
	}

	/**
	 * 是否为最后节点
	 */
	public void setLeaf(Boolean leaf) {
		this.leaf = leaf;
	}

	public Map<String, Object> getOther() {
		return other;
	}

	public void setOther(Map<String, Object> other) {
		this.other = other;
	}

	public List<DictionaryItem> getChildren() {
		return children;
	}

	public void setChildren(List<DictionaryItem> children) {
		this.children = children;
	}
	
	public DictionaryItem copy() {
		DictionaryItem item = new DictionaryItem();
		item.setId(this.getId());
		item.setPid(this.getPid());
		item.setAbbreviation(this.getAbbreviation());
		item.setCode(this.getCode());
		item.setDisplay(this.getDisplay());
		item.setInfo(this.getInfo());
		item.setLeaf(this.getLeaf());
		item.setLevel(this.getLevel());
		item.setOrder(this.getOrder());
		item.setOther(this.getOther());
		item.setUnits(this.getUnits());
		item.setValid(this.getValid());
		return item;
	}
}
